<template>
	<view>
		<u-navbar title="行权记录" :autoBack="true" :placeholder="true" leftIconColor="#ffffff" :titleStyle="{color: '#ffffff'}" bgColor="#E60000">
		</u-navbar>
		<view class="padding border-bottom bg-white margin radius-8" v-for="(item, index) in walletList" :key="index">
			<view class="flex justify-between font-16 text-bold">
				<view>行权</view>
				<view>{{item.incomeFlag ? '+' : '-'}}{{item.amount}}</view>
			</view>
			<view class="text-black3 margin-tb-sm font-14">
				{{item.remark}}
			</view>
			<view class="flex justify-between font-14">
				<view class="text-gray">{{item.createTime}}</view>
				<view class="text-gray" style="flex: none;">积分余额：{{item.afterAmount}}</view>
			</view>
		</view>

		<empty :show="walletList.length == 0" />

		<u-loadmore :status="status" color="#cccccc" class="padding-bottom" />
	</view>
</template>

<script>
	import { walletFlow } from '@/common/api/customer.js'
	export default {
		data() {
			return {
				pageNo: 0,
				walletList: [],
				status: 'loading',
				walletType: 1,
			};
		},
		onLoad(options) {
			this.getwalletFlow()
		},
		onReachBottom() {
			if(this.status === 'loading'){
				this.getwalletFlow()
			}
		},
		methods: {
			getwalletFlow(walletType) {
				this.pageNo++
				this.status = 'loading'
				let params = {
					pageNo: this.pageNo,
					pageSize: 10,
					bizCode: 500
				}
				walletFlow(params,this.walletType).then(res => {
					if(res.code === 200){
						if(this.pageNo == 1){
							this.walletList = res.data
						}else{
							this.walletList = this.walletList.concat(res.data)
						}
						if (res.data.length < 10) {
							this.status = 'nomore'
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
page {
	background: #F2F3F5;
}
</style>
